﻿using Magicodes.ExporterAndImporter.Excel.AspNetCore;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using NP.BPMReportPlatform.AUTO.Adjust.Dto;
using NP.BPMReportPlatform.AUTO.Quotation.Dto;
using NP.BPMReportPlatform.AUTO.TechnicalDependence.Dto;
using NP.BPMReportPlatform.IC;
using NP.BPMReportPlatform.IC.ICZHYLS.Dto;
using NP.BPMReportPlatform.IUTS.Dto;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;

namespace NP.BPMReportPlatform.ICQuotation
{
    /// <summary>
    ///IC价格管理
    /// </summary>
    [Authorize]
    [ApiController]
    [Route("api/icquotation")]
    public class ICQuotationController : BPMReportPlatformController
    {
        private readonly IICQuotationAppService _iczhylsService;

        public ICQuotationController(IICQuotationAppService iczhylsService)
        {
            _iczhylsService = iczhylsService;
        }

        /// <summary>
        ///IC价格管理审批流程 查询数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("ICQuotation/GetAllAsync")]
        public async Task<PagedResultDto<ICQuotationOutput>> GetAllAsync([FromBody] GetICQuotationInput input)
        {
            return await _iczhylsService.GetAllAsync(input);
        }

        /// <summary>
        ///IC价格管理审批流程 导出数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("ICQuotation/Export1Async")]
        public async Task<XlsxFileResult<ExportICQuotationOutput>> Export1Async([FromBody] GetICQuotationInput input)
        {
            var rst = await _iczhylsService.Export1Async(input);
            return new XlsxFileResult<ExportICQuotationOutput>(rst, "导出Excel");
        }


        /// <summary>
        ///IC价格管理审批流程 查询数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("ICQuotation/GetAllAsyncYunFei")]
        public async Task<PagedResultDto<ICQuotationOutputYunFei>> GetAllAsyncYunFei([FromBody] GetICQuotationInputYunFei input)
        {
            return await _iczhylsService.GetAllAsyncYunFei(input);
        }

        /// <summary>
        ///IC价格管理审批流程 导出数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("ICQuotation/Export1AsyncYunFei")]
        public async Task<XlsxFileResult<ExportICQuotationOutputYunFei>> Export1AsyncYunFei([FromBody] GetICQuotationInputYunFei input)
        {
            var rst = await _iczhylsService.Export1AsyncYunFei(input);
            return new XlsxFileResult<ExportICQuotationOutputYunFei>(rst, "导出Excel");
        }
    }
}
